<!--Copyright (C) Kherty.  All rights reserved.-->
<ResourceDictionary
  x:Class="OpenLS.Spreadsheet.UI.WorksheetPaneResources"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:ss="http://schemas.Kherty.com/office/2007/spreadsheet"
  xmlns:omedia="http://schemas.Kherty.com/office/2007/media"
  xmlns:ssui="clr-namespace:OpenLS.Spreadsheet.UI" xmlns:UI="clr-namespace:OpenLS.UI;assembly=OpenLS.UI" xmlns:Internals="clr-namespace:OpenLS.Spreadsheet.UI.Internals">
    <ResourceDictionary.MergedDictionaries>
        <ssui:WorksheetPaneCellResources/>
    </ResourceDictionary.MergedDictionaries>
    <BooleanToVisibilityConverter x:Key="boolToVisibility"/>
    <ContextMenu UI:RibbonElement.ControlState="Medium" x:Key="{x:Static ss:SpreadsheetWindowComponents.DefaultWorksheetColumnsContextMenuKey}">
        <MenuItem Command="{x:Static ApplicationCommands.Cut}" CommandParameter="{Binding}"/>
        <MenuItem Command="{x:Static ApplicationCommands.Copy}" CommandParameter="{Binding}"/>
        <MenuItem Command="{x:Static ApplicationCommands.Paste}" CommandParameter="{Binding}"/>
        <MenuItem Command="{x:Static ssui:ClipboardCommands.PasteSpecial}" CommandParameter="{Binding}"/>
        <Separator/>
        <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.InsertColumn}" />
        <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.DeleteColumns}" CommandParameter="{Binding}"/>
        <MenuItem Command ="{x:Static ssui:SpreadsheetEditingCommands.ClearContents}" CommandParameter="{Binding}"/>
        <Separator/>
        <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.FormatCells}" CommandParameter="{Binding}"/>
        <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.SetColumnWidth}" CommandParameter="{Binding}"/>
        <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.HideColumns}" CommandParameter="{Binding}"/>
        <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.UnhideColumns}" CommandParameter="{Binding}"/>
    </ContextMenu>

    <DataTemplate DataType="{x:Type ss:WorksheetPane}" x:Key="paneColumns">
        <ssui:ColumnsControl Panel.ZIndex="1"  Position="{Binding Left}" 
                             Internals:AdditionalTags.Tag1="{DynamicResource {x:Static ss:SpreadsheetWindowComponents.WorksheetColumnsContextMenuKey}}"
                             Internals:AdditionalTags.Tag2="{DynamicResource {x:Static ss:SpreadsheetWindowComponents.DefaultWorksheetColumnsContextMenuKey}}">
        	<ssui:ColumnsControl.ContextMenu>
                <MultiBinding Converter="{x:Static Internals:FirstNonNullConverter.Instance}">
                    <Binding RelativeSource="{RelativeSource Self}" Path="(Internals:AdditionalTags.Tag1)"></Binding>
                    <Binding RelativeSource="{RelativeSource Self}" Path="(Internals:AdditionalTags.Tag2)"></Binding>
                </MultiBinding>
            </ssui:ColumnsControl.ContextMenu>
        </ssui:ColumnsControl>
    </DataTemplate>
    <ContextMenu UI:RibbonElement.ControlState="Medium" x:Key="{x:Static ss:SpreadsheetWindowComponents.DefaultWorksheetRowsContextMenuKey}">
        <MenuItem Command="{x:Static ApplicationCommands.Cut}" CommandParameter="{Binding}"/>
        <MenuItem Command="{x:Static ApplicationCommands.Copy}" CommandParameter="{Binding}"/>
        <MenuItem Command="{x:Static ApplicationCommands.Paste}" CommandParameter="{Binding}"/>
        <MenuItem Command="{x:Static ssui:ClipboardCommands.PasteSpecial}" CommandParameter="{Binding}"/>
        <Separator/>
        <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.InsertRow}" CommandParameter="{Binding}"/>
        <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.DeleteRows}" CommandParameter="{Binding}"/>
        <MenuItem Command ="{x:Static ssui:SpreadsheetEditingCommands.ClearContents}" CommandParameter="{Binding}"/>
        <Separator/>
        <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.FormatCells}" CommandParameter="{Binding}"/>
        <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.SetRowHeight}" CommandParameter="{Binding}"/>
        <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.HideRows}" CommandParameter="{Binding}"/>
        <MenuItem Command ="{x:Static ssui:SpreadsheetCommands.UnhideRows}" CommandParameter="{Binding}"/>
    </ContextMenu>
    <DataTemplate DataType="{x:Type ss:WorksheetPane}" x:Key="paneRows">
        <ssui:RowsControl Panel.ZIndex ="1" Position="{Binding Top}"
                    Internals:AdditionalTags.Tag1="{DynamicResource {x:Static ss:SpreadsheetWindowComponents.WorksheetRowsContextMenuKey}}"
                    Internals:AdditionalTags.Tag2="{DynamicResource {x:Static ss:SpreadsheetWindowComponents.DefaultWorksheetRowsContextMenuKey}}">
            <ssui:RowsControl.ContextMenu>
                <MultiBinding Converter="{x:Static Internals:FirstNonNullConverter.Instance}">
                    <Binding RelativeSource="{RelativeSource Self}" Path="(Internals:AdditionalTags.Tag1)"></Binding>
                    <Binding RelativeSource="{RelativeSource Self}" Path="(Internals:AdditionalTags.Tag2)"></Binding>
                </MultiBinding>

            </ssui:RowsControl.ContextMenu>
        </ssui:RowsControl>
    </DataTemplate>

</ResourceDictionary>